#include <sys/time.h>

struct lab6_hdr {
    uint32_t sequence_number;
    uint32_t ack_number;
    uint8_t fin;
};

typedef struct {
    int valid;
    /* TODO: add state for in-flight packets here. */
} inflight_packet;

#define MAX_PACKET 1400
#define MAX_SEGMENT (MAX_PACKET-sizeof(struct lab6_hdr))

int my_socket(int domain, int type, int protocol);
int my_connect(int socket,struct sockaddr_in *toaddr,int addrsize);
void my_send(int sock, void *buf, size_t len);
int my_recv(int sock, void * buffer, size_t length);
int my_close(int sock);
int my_rtt(int sock);

int timeval_to_msec(struct timeval *t);
void msec_to_timeval(int millis, struct timeval *out_timeval);
int current_msec();

